<!-- 交易额排名 -->
<template>
  <div class="rank">
    <h3>商户月交易额排名</h3>
    <div class="rankBox">
      <div class="rankItem" v-for="(item, index) in list" :key="index">
        <div class="leftBox">
          <div class="imgBox">
            <img src="@/assets/home/cs.png" alt="">
          </div>
    
          <div class="flexBox">
            <p>{{ item.name }}</p>
            <div class="des">{{ item.category }}</div>
          </div>
        </div>

        <div class="flexBox">
          <div></div>
          <div class="num">￥{{ item.amount }}</div>
        </div>
      </div>
    </div>
  </div>
</template>

<script>
import { getMerchantRange } from "@/api/home";
export default {
  name: "Rank",
  data() {
    return {
      list: []
    };
  },
  created() {
    this.getMerchantRange();
  },
  methods: {
    getMerchantRange() {
      getMerchantRange({}).then(res => {
        this.list = res.data;
      });
    }
  }
};
</script>

<style lang="scss">
.rank {
  display: grid;
  grid-gap: 10px;
  grid-template-rows: 30px 1fr;
  background: #fff;
  border-radius: 5px;
  padding: 20px 15px;
  overflow: hidden;

  .rankBox {
    overflow-y: auto;

    .rankItem {
      display: flex;
      justify-content: space-between;
      margin-bottom: 20px;

      .leftBox {
        display: flex;

        .imgBox {
          width: 67px;
          height: 67px;
          border-radius: 5px;
          margin-right: 20px;
        }
      }

      .flexBox {
        display: flex;
        flex-direction: column;
        justify-content: space-between;

        .des {
          color: #859da9;
          font-size: 12px;
        }

        .num {
          color: #2a67fe;
          font-weight: 600;
        }
      }
    }
  }

  .rankBox::-webkit-scrollbar {
    display: none;
    /* 隐藏滚动条 */
  }
}
</style>
